<!DOCTYPE html>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>用户中心</title>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">


    <link rel="stylesheet" href="/forum/css/main.min.css">
    <link rel="bookmark" type="image/x-icon" href="forum/images/favicon.ico">
    <link rel="shortcut icon" type="image/x-icon" href="/forum/images/favicon.ico">

    <link rel="stylesheet" href="/forum/css/thirdStylePersonal.css">

    <link rel="stylesheet" href="/forum/css/demo.css">
    <link rel="stylesheet" href="/forum/css/personalProfile.css">
    <link rel="stylesheet" href="/forum/css/peoplehomepage.css">
    <link rel="stylesheet" href="/forum/css/mystyle.css">
    <script type="text/javascript" src="/forum/lib/jquery.min.js"></script>
    <style>
        .datum-table th{vertical-align: inherit;}
    </style>
</head>
<body>
<div id="body">

    <div th:replace="forum/header"></div>
    <!--*******************************-->
    <main class="main-wrapper">
        <div class="container-area">
            <div class="container-area-left">

                <!--头像 start-->
                <div class="card-media personal-card" th:style="${otherUser =='0'?'padding-bottom: 0px;':''}">
                    <div class="avatar-container-80 z-center">
                        <a th:href="@{'/forum/u/'+${userId}}" th:title="${userName}" class="author-avatar" target="_blank" >
                            <img th:src="${avatar}" width="80" height="80" th:title="${userName}" alt="">
                        </a>

                    </div>
                    <div class="presonal-info">
                        <a th:href="@{'/forum/u/'+${userId}}" class="author-name" target="_blank"
                           th:title="${userName}" z-st="user_card_1_name" th:text="${userName}"></a>
                    </div>
                    <div style="margin-top: 17px;margin-bottom: 13px;">
                        <table style="position: relative;margin: 0 auto;">
                            <tbody>
                            <tr>
                                <td>
                                    <strong><a href="javascipt:void(0);">[[${questionCount}]]</a></strong>
                                    <span style="font-size: 12px;color:#666;">帖子</span>
                                </td>
                                <td>|</td>
                                <td>
                                    <strong><a href="javascipt:void(0);">[[${look}]]</a></strong>
                                    <span style="font-size: 12px;color:#666;">访问</span>
                                </td>
                                <td>|</td>
                                <td>
                                    <strong><a href="javascipt:void(0);">[[${fansCount}]]</a></strong>
                                    <span style="font-size: 12px;color:#666;">粉丝</span>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>

                    <div class="btn-area" th:if="${loginUser ==null}">
                        <a onclick="addFocus(this)" th:data-userid="${userId}"  class="btn-default-main card-media-mid-btn">关 注</a><br />
                        <a onclick="showSendMessage(this)" th:data-username="${userName}" th:data-userid="${userId}"  style="margin-top: 8px;" class="btn-default-secondary card-media-mid-btn" >发私信</a><br />
                    </div>
                    <div class="btn-area"  th:if="${loginUser !=null}" th:style="${otherUser =='0'?'height: 80px;':''}">
                        <a href="/uploadQuestion" style="margin-top: 18px;"   th:if="${otherUser =='0'}" class="btn-default-main card-media-mid-btn">发 帖</a><br />
                        <a id="focusBtn" onclick="addFocus(this)"   th:data-userid="${userId}"  th:if="${otherUser =='1'}" class="btn-default-main card-media-mid-btn">关 注</a><br />
                        <a onclick="showSendMessage(this)"  style="margin-top: 8px;"   th:data-userid="${userId}"   th:data-username="${userName}"  th:if="${otherUser =='1'}" class="btn-default-secondary card-media-mid-btn">发私信</a><br />
                    </div>
                    <div class="clear"></div>
                </div>
                <!--头像 end-->

                <!--菜单 start-->
                <div class="card-media personal-menu">

                    <ul class="menu-list">
                        <li class="menu-list-default current">
                            <i></i><a id="left-data-account-focus">Ta的资料</a></li>
                    </ul>

                    <ul class="menu-list">
                        <li class="menu-list-default "><i></i>
                            <a th:href="@{'/forum/taQuestion/'+${userId}}" id="usercenter-menu-focus-left">Ta的帖子
                            </a>
                        </li>
                        <li class="menu-list-default ">
                            <i></i><a th:href="@{'/forum/taFocus/'+${userId}}">Ta的关注</a></li>

                    </ul>
                </div>
                <!--菜单 end-->

                <!--访客 start-->
                <div class="show-list-box " style="margin-top: 9px;">
                    <div class="show-list-title-box border-bottom">
                        <span class="show-list-title">访客</span>
                    </div>
                    <div id="recent_view_member">
                        <div class="visitor-wrap">
                            <ul class="visitor-box" id="visitUserList">

                                <!--<li class="visitor-list" th:each="item,index:${visitUsers}">
                                    <div class="avatar-container-48">
                                        <a th:href="@{'/forum/u/'+${item.userId}}"  target="_blank" th:title="${item.userName}" class="visitor-head">
                                            <img th:src="${item.avatar}" width="48" height="48">
                                        </a>
                                    </div>
                                    <a th:href="@{'/forum/u/'+${item.userId}}" target="_blank" th:title="${item.userName}" th:text="${item.userName}" class="visitor-name"></a>
                                    <span th:text="${item.timeDesc}"></span>

                                </li>-->

                            </ul>
                        </div>
                    </div>
                </div>
                <!--访客 end-->
            </div>

            <div class="container-area-right">
                <div class="bg-box-radius">

                    <div class="tab-menu border-bottom">
                        <ul class="tab-box">
                            <li  class="current" ><a>基本信息</a></li>
                            <li ><a>详细信息</a></li>
                            <li ><a>联系方式</a></li>
                        </ul>
                    </div>


                    <div class="datum-item-box border-bottom" id="essentialinformation">

                        <!--<div class="datum-title-box">
                            基本信息
                        </div>-->
                        <div class="table-wrap">
                            <table class="datum-table" cellspacing="0">
                                <tbody>
                                <tr>
                                    <th class="padding-top-30">积分</th>
                                    <td class="padding-top-30" >[[${score}]]点
                                    </td>
                                </tr>
                                <tr>
                                    <th>手机号</th>
                                    <td>
                                        <div class="always">
                                            [[${phone}]]
                                            <a th:if="${phoneFlag==1}" class="modify" style="color:green; ">已验证</a>
                                            <a th:if="${phoneFlag==0}" class="modify" style="color:red; ">未验证</a>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <th>真实姓名</th>
                                    <td>
                                        <div class="always" th:if="${#strings.isEmpty(user?.real_name)}" >
                                            <span class="permission-prompt" style="margin-left: 0px;">未设置</span>
                                        </div>
                                        <div class="always" th:if="${not #strings.isEmpty(user?.real_name)}" >
                                            [[${user.real_name}]]
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <th>身份证号</th>
                                    <td>
                                        <div class="always" th:if="${#strings.isEmpty(user?.id_card)}" >
                                            <span class="permission-prompt" style="margin-left: 0px;">未设置</span>

                                        </div>
                                        <div class="always" th:if="${not #strings.isEmpty(user?.id_card)}" >
                                            [[${user?.id_card}]]
                                        </div>
                                    </td>
                                </tr>

                                <tr>
                                    <th class="padding-top-30">邮箱</th>
                                    <td class="padding-top-30">
                                        <div class="always">
                                            [[${email}]]
                                            <a th:if="${emailFlag==1}" class="modify" style="color:green; ">已验证</a>
                                            <a th:if="${emailFlag==0}" class="modify" style="color:red; ">未验证</a>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <th class="padding-top-30"><span class="required-sign"></span>性别</th>
                                    <td class="padding-top-30" th:if="${sex=='1'}" th:text="男"></td>
                                    <td class="padding-top-30" th:if="${sex=='0'}" th:text="女"></td>

                                </tr>
                                <tr>
                                    <th class="padding-top-30">生日</th>
                                    <td class="padding-top-30" th:if="${#strings.isEmpty(user?.birthday)}">
                                        <div class="always">
                                            <span class="permission-prompt" style="margin-left: 0px;">未设置</span>
                                        </div>
                                    </td>
                                    <td class="padding-top-30" th:if="${not #strings.isEmpty(user?.birthday)}"  th:text="${user?.birthday}"></td>
                                </tr>
                                <tr>
                                    <th>家乡</th>
                                    <td>
                                        <section>
                                            <input type="hidden" id="homeProvinceValue" th:value="${homeProvinceValue}">
                                            <input type="hidden" id="homeCityValue" th:value="${homeCityValue}">
                                            <input type="hidden" id="homeDistrictValue" th:value="${homeDistrictValue}">

                                            <div class="col" style="float:left;">
                                                <div class="wrapper">
                                                    <select id="homeCity" onChange="initCity2('home')" disabled class="dropdown" tabindex="7" data-settings='{"wrapperClass":"flat"}'>
                                                        <option value=''>--请选择--</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="col" style="float:left;margin-left: 5px;display: none;" id="homeCity2Div">
                                                <div class="wrapper">
                                                    <select id="homeCity2" onChange="initCity3('home')" disabled class="dropdown" tabindex="7" data-settings='{"wrapperClass":"flat"}'>
                                                        <option value=''>--请选择--</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="col" style="float:left;margin-left: 5px;display: none;" id="homeCity3Div">
                                                <div class="wrapper">
                                                    <select id="homeCity3" onChange="city3Change('home')" disabled  class="dropdown" tabindex="7" data-settings='{"wrapperClass":"flat"}'>
                                                        <option value=''>--请选择--</option>
                                                    </select>
                                                </div>
                                            </div>
                                        </section>
                                    </td>
                                </tr>
                                <tr>
                                    <th><span class="required-sign"></span>现居</th>
                                    <td>
                                        <section>

                                            <input type="hidden" id="nowProvinceValue" th:value="${nowProvinceValue}">
                                            <input type="hidden" id="nowCityValue" th:value="${nowCityValue}">
                                            <input type="hidden" id="nowDistrictValue" th:value="${nowDistrictValue}">

                                            <div class="col" style="float:left;">
                                                <div class="wrapper">
                                                    <select id="nowCity" onChange="initCity2('now')" disabled class="dropdown" tabindex="8" data-settings='{"wrapperClass":"flat"}'>
                                                        <option value=''>--请选择--</option>
                                                    </select>
                                                </div>
                                            </div>

                                            <div class="col" style="float:left;margin-left: 5px;display: none;" id="nowCity2Div">
                                                <div class="wrapper">
                                                    <select id="nowCity2" onChange="initCity3('now')" disabled class="dropdown" tabindex="7" data-settings='{"wrapperClass":"flat"}'>
                                                        <option value=''>--请选择--</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="col" style="float:left;margin-left: 5px;display: none;" id="nowCity3Div">
                                                <div class="wrapper">
                                                    <select id="nowCity3" onChange="city3Change('now')" disabled class="dropdown" tabindex="7" data-settings='{"wrapperClass":"flat"}'>
                                                        <option value=''>--请选择--</option>
                                                    </select>
                                                </div>
                                            </div>

                                        </section>
                                    </td>
                                </tr>
                                <tr>
                                    <th><span class="required-sign"></span>职业</th>
                                    <td>
                                        <section>
                                            <div class="col job-select" style="float:left;">
                                                <div class="wrapper">
                                                    <select class="dropdown" disabled tabindex="9" data-settings='{"wrapperClass":"flat"}'>


                                                        <option data-id="1" th:selected="${user?.job=='1'}">学生</option>

                                                        <option data-id="2" th:selected="${user?.job=='2'}">设计爱好者</option>

                                                        <option data-id="3" th:selected="${user?.job=='3'}">建筑师</option>

                                                        <option data-id="4" th:selected="${user?.job=='4'}">服装设计师</option>

                                                        <option data-id="5"  th:selected="${user?.job=='5'}">手工艺人</option>

                                                        <option data-id="6" th:selected="${user?.job=='6'}">教育工作者</option>

                                                    </select>
                                                </div>
                                            </div>
                                        </section>
                                    </td>
                                </tr>
                                <tr>
                                    <th class="padding-top-30">注册时间</th>
                                    <td class="padding-top-30" th:text="${#dates.format(createTime,'yyyy-MM-dd HH:mm:ss')}"></td>
                                </tr>
                                <tr>
                                    <th valign="top" class="brief-introduction">标签</th>
                                    <td class="padding-top-30">
                                        <div class="mark-con" style=" margin-top: 11px;">
                                            <span class="mark" style="display:inline-block;text-align: center;" th:each="tag:${tags}" th:title="${tag}" >[[${tag}]]</span>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <th valign="top" class="brief-introduction">简介</th>
                                    <td class="padding-top-30">
                                        <div class="long-text-box">
                                            <textarea id="description" disabled class="text-style textarea-style" onpropertychange="MaxMe(this)" oninput="MaxMe(this)">[[${description}]]</textarea>
                                        </div>
                                    </td>
                                </tr>
                                </tbody></table>

                        </div>
                    </div>

                    <div class="datum-item-box border-bottom" style="display: none" id="detail">
                        <div class="table-wrap">
                            <table class="datum-table left" cellspacing="0" style="    width: 100%;">
                                <tbody>

                                <tr>
                                    <th>身高</th>
                                    <td>
                                        <div class="">
                                            <input type="text" name="height" id="height" disabled th:value="${user?.height}" placeholder="" class="text-style"><span class="modify">CM</span>
                                        </div>

                                    </td>
                                </tr>
                                <tr>
                                    <th>体重</th>
                                    <td>
                                        <div class="">
                                            <input type="text" name="weight" id="weight" disabled th:value="${user?.weight}" placeholder="" class="text-style"><span class="modify">KG</span>
                                        </div>
                                    </td>
                                </tr>

                                <tr>
                                    <th>学历</th>
                                    <td>
                                        <section>
                                    <div class="col education" style="float:left;">
                                        <div class="wrapper">
                                            <select class="dropdown" tabindex="9" disabled th:with="type=${@dict.getType('education')}" data-settings='{"wrapperClass":"flat"}'>
                                                <option value="">-请选择-</option>
                                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:selected="${dict.dictValue==user?.education}" th:data-id="${dict.dictValue}"  ></option>
                                            </select>
                                        </div>
                                    </div>
                                </section>
                                    </td>
                                </tr>




                                <tr>
                                    <th>民族</th>
                                    <td>
                                        <section>
                                            <div class="col minzhu" style="float:left;">
                                                <div class="wrapper">
                                                    <select class="dropdown" tabindex="9" disabled th:with="type=${@dict.getType('minzu')}" data-settings='{"wrapperClass":"flat"}'>
                                                        <option value="">-请选择-</option>
                                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:selected="${dict.dictValue==user?.minzhu+''}"  th:data-id="${dict.dictValue}"  ></option>
                                                    </select>
                                                </div>
                                            </div>
                                        </section>
                                    </td>
                                </tr>

                                <tr>
                                    <th>星座</th>

                                    <td class="padding-top-10" th:if="${#strings.isEmpty(user?.xingzuo)}">
                                        <span class="permission-prompt" style="margin-left: 0px;">未设置</span>
                                    </td>
                                    <td class="padding-top-10" th:if="${not #strings.isEmpty(user?.xingzuo)}"  th:text="${user?.xingzuo}"></td>

                                </tr>


                                <tr>
                                    <th>血型</th>
                                    <td>
                                        <section>
                                            <div class="col xuexing" style="float:left;">
                                                <div class="wrapper">
                                                    <select class="dropdown" disabled tabindex="9" th:with="type=${@dict.getType('xuexing')}" data-settings='{"wrapperClass":"flat"}'>
                                                        <option value="">-请选择-</option>
                                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:selected="${dict.dictValue==user?.xuexing+''}"  th:data-id="${dict.dictValue}"  ></option>
                                                    </select>
                                                </div>
                                            </div>
                                        </section>
                                    </td>
                                </tr>

                                <tr>
                                    <th>属相</th>

                                    <td class="padding-top-10" th:if="${#strings.isEmpty(user?.shuxiang)}">

                                        <span class="permission-prompt" style="margin-left: 0px;">未设置</span>

                                    </td>
                                    <td class="padding-top-10" th:if="${not #strings.isEmpty(user?.shuxiang)}"  th:text="${user?.shuxiang}"></td>

                                </tr>


                                <tr>
                                    <th>婚姻状态</th>
                                    <td>
                                        <section>
                                            <div class="col marriage" style="float:left;">
                                                <div class="wrapper">
                                                    <select class="dropdown" tabindex="9" disabled th:with="type=${@dict.getType('marriage')}" data-settings='{"wrapperClass":"flat"}'>
                                                        <option value="">-请选择-</option>
                                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:selected="${dict.dictValue==user?.marriage+''}"  th:data-id="${dict.dictValue}"  ></option>
                                                    </select>
                                                </div>
                                            </div>
                                        </section>
                                    </td>
                                </tr>

                                <tr>
                                    <th>有无子女</th>
                                    <!--<td class="padding-top-30">
                                        <div class="radio">
                                            <label for="radio_children1" disabled="disabled" th:class="${user?.children==0}?'radio-0':'radio-1'"><input type="radio" name="children" id="radio_children1" value="0">无</label>
                                            <label for="radio_children2" disabled th:class="${user?.children==1}?'radio-0':'radio-1'"><input type="radio" name="children" id="radio_children2" value="1">有</label>
                                        </div>-->
                                    <td class="padding-top-10" th:if="${user?.children==0}"  >无</td>
                                    <td class="padding-top-10" th:if="${user?.children==1}"  >有</td>
                                    </td>
                                </tr>

                                <tr>
                                    <th>学校名称</th>
                                    <td>
                                        <div class="school-name-wrap">
                                            <div class="morktext-box">
                                                <input type="text" name="school-name" disabled th:value="${highSchool}" th:data-id="${highSchoolId}" placeholder="请填写学校" id="school-name" class="text-style short-text-box">
                                            </div>
                                            <div class="matching-list school-name-list hide">
                                                <ul class="scrollbar">
                                                </ul>
                                                <div class="empty hide">
                                                    没有匹配学校
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>

                                <tr>
                                    <th>月收入</th>
                                    <td>
                                        <section>
                                            <div class="col salary" style="float:left;">
                                                <div class="wrapper">

                                                    <select class="dropdown" disabled tabindex="9" th:with="type=${@dict.getType('salary')}" data-settings='{"wrapperClass":"flat"}'>
                                                        <option value="">-请选择-</option>
                                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:selected="${dict.dictValue==user?.salary+''}"  th:data-id="${dict.dictValue}" ></option>
                                                    </select>
                                                </div>
                                            </div>
                                        </section>
                                    </td>
                                </tr>

                                </tbody></table>
                        </div>
                    </div>

                    <div class="datum-item-box border-bottom" style="display: none"  id="contact">

                        <div class="table-wrap">
                            <table class="datum-table left" cellspacing="0">
                                <tbody><tr>
                                    <th>QQ</th>
                                    <td><input type="text" name="qq-account" disabled th:if="${user?.qqPrivate==1}" maxlength="20" class="text-style short-text-box" th:value="${user?.qq}" >
                                        <div class="dropdown-box">
                                            <section>
                                                <div class="col">
                                                    <div class="wrapper">
                                                        <select class="dropdown" disabled id="qq-privacy" tabindex="9" data-settings='{"wrapperClass":"flat"}'>
                                                            <option value="0" data-id="0"  th:selected="${user?.qqPrivate==0}" >仅自己可见</option>
                                                            <option value="1" data-id="1"  th:selected="${user?.qqPrivate==1}">所有人可见</option>
                                                        </select>
                                                    </div>
                                                </div>
                                            </section>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <th>微信</th>
                                    <td><input type="text" name="wechat" disabled th:if="${user?.wxPrivate==1}" maxlength="30" class="text-style short-text-box" th:value="${user?.wx}">
                                        <div class="dropdown-box">
                                            <section>
                                                <div class="col">
                                                    <div class="wrapper">
                                                        <select class="dropdown" disabled id="wechat-privacy" tabindex="9" data-settings='{"wrapperClass":"flat"}'>
                                                            <option value="1" data-id="1"  th:selected="${user?.wxPrivate==1}">所有人可见</option>
                                                            <option value="0" data-id="0"  th:selected="${user?.wxPrivate==0}">仅自己可见</option>
                                                        </select>
                                                    </div>
                                                </div>
                                            </section>
                                        </div>
                                    </td>
                                </tr>
                                </tbody></table>

                        </div>
                    </div>



                    <div class="pop-up-normal datum-tips-pop hide">
                        <p class="tips-text tips-text-normal"></p>
                    </div>


                </div>

            </div>
        </div>
    </main>
    <!--*******************************-->
    <div th:replace="forum/footer"></div>
    <div style="display: none">
        <div id="empty_message_box" class="msg-box-null">
            <div class="msg-box-inner">
                <span class="null-images"></span>
                <span class="msg-null-tips">没有新消息</span>
            </div>
        </div>
    </div>

</div>

<!-- 登录弹窗 -->
<div class="alert-confirm hide">
    <p class="tips-text tips-alert-text"></p>
    <div class="text-center pop-btn-con">
        <input type="button" name="" class="btn-default-main pop-confirm" value="我知道了">
    </div>
    <i class="pop-close"></i>
</div>
<div class="pop-up-confirm hide">
    <p class="tips-text"></p>
    <div class="text-center pop-btn-con">
        <input type="button" name="" class="btn-default-main pop-confirm" value="确定">
        <input type="button" name="" class="btn-default-secondary pop-cancel" value="取消">
    </div>
    <i class="pop-close"></i>
</div>
<div class="toast-fail hide">
    <span class="toast-pictrue"></span>
    <div class="toast-tips-text">
        <span class="toast-first-text"></span> <br>
        <span class="toast-socend-text"></span>
    </div>
</div>
<div class="toast-success hide">
    <span class="toast-pictrue"></span>
    <div class="toast-tips-text">
        <span class="toast-first-text"></span> <br>
        <span class="toast-socend-text"></span>
    </div>
</div>

<div class="shade hide"></div>
<!--写私信弹框-->
<div class="pop-up private-pop hide">
    <div class="popup-title">写私信</div>
    <div class="popup-con">
        <div class="p-relative">
            <input type="hidden" id="message_userid" name="" >
            <input type="text" id="message_username" name="" placeholder="发送给..." class="text-style" disabled>
        </div>
        <div class="p-relative mt-20">
        </div>
        <div class="pinlunt mt-20">
            <textarea type="text" id="private-textarea" name=""  class="textarea-style2 pop-textarea" style="padding-right: 50px;"></textarea><!--<span class="count">600</span>-->
        </div>
        <div class="text-center">
            <input type="button" onclick="sendMessage()"   name="" class="btn-default-main pop-confirm" value="确定">
            <input type="button" onclick="closeSendMessage()" class="btn-default-secondary pop-cancel" value="取消">
        </div>
    </div>
    <i onclick="closeSendMessage()" class="pop-close"></i>
</div>


<script src="/forum/lib/mCustomScrollbar/jquery.mCustomScrollbar.min.js"></script>
<script type="text/javascript" src="/forum/js/common.js"></script>
<script type="text/javascript" src="/forum/lib/jquery.easydropdown-version0.1.js"></script>

<script src="/forum/lib/edtiorCrop/js/bootstrap.min.js"></script>
<script  th:src="@{/ruoyi/js/ry-ui.js}"></script>
<script type="text/javascript" src="/forum/js/personalProfile.js"></script>
<script th:inline="javascript"> var ctx = [[@{/}]];</script>
<script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
<script th:src="@{/ruoyi/js/fast.js}"></script>
<script th:src="@{/ajax/libs/laypage/laypage.js}"></script>
<script>
    var isLogin='[[${loginUser!=null}]]';
    var userFocusFlag='[[${focusFlag}]]';
    var userId='[[${userId}]]';
    function initVisitUserList(){

        $.ajax({
            type: "post",
            url: ctx+"forum/initVisitUserList/"+userId,
            data: null,
            xhrFields: {
                withCredentials: true
            },
            dataType: "json",
            success: function(json) {
                if(json.code==0||json.code=='0'){
                    var rows=json.data;
                    var html="";
                    $.each(rows,function(index,v){
                        if(index>8){
                        return;
                        }
                       html+='<li class="visitor-list">';
                        html+='<div class="avatar-container-48">';
                        html+='<a href="/forum/u/'+v.userId+'"  target="_blank" title="'+v.userName+'" class="visitor-head">';
                        html+='<img src="'+v.avatar+'" width="48" height="48">';
                        html+='</a>';
                        html+='</div>';
                        html+='<a href="/forum/u/'+v.userId+'"   target="_blank" title="'+v.userName+'"   class="visitor-name">'+v.userName+'</a>';
                        html+='<span>'+v.timeDesc+'</span>';
                        html+='</li>';
                        if((index+1)%3==0){
                            html+="<br/>"
                        }
                    })
                    $("#visitUserList").html(html);
                }else{
                    Fast.msg_error(json.msg)
                }
            }
        })
    }
    //关注用户
    function addFocus(obj){
        var focus_user_id=$(obj).data("userid");
        if(isLogin=='false'){
            openLoginWindow();
            return;
        }

        $.ajax({
            type: "post",
            url: ctx+"forumQuestion/addFocus/"+focus_user_id,
            data: null,
            xhrFields: {
                withCredentials: true
            },
            dataType: "json",
            success: function(data) {
                if(data.code==0||data.code=='0'){
                    Fast.msg_success("关注成功!");
                    $("#focusBtn").text("取消关注");
                    $("#focusBtn").removeAttr("onclick").attr("onclick","removeFocus(this)");
                }else{
                    Fast.msg_error(data.msg)
                }
            }
        })
    }
    function showSendMessage(obj){
        var userid=$(obj).data("userid");
        var username=$(obj).data("username");
        if(isLogin=='false'){
            openLoginWindow();
            return;
        }
        if(userid==getUid()){
            pageToastFail("不能发消息给自己哦");
            return;
        }
        showGlobalMaskLayer();
        $(".private-pop").show();
        $("#message_userid").val(userid);
        $("#message_username").val(username);
    }
    function closeSendMessage(){
        hideGlobalMaskLayer();
        $(".private-pop").hide();

    }
    function sendMessage(){
        var userId=$("#message_userid").val();
        var userName=$("#message_username").val();
        var content=$("#private-textarea").val();
        if(isEmpty(content)){
            pageToastFail("内容不能为空!");
            return;
        }
        $.ajax({
            type: "post",
            url: ctx+"forum/message/add",
            data: {"toId":userId,"toName":userName,"content":content,"type":"private"},
            xhrFields: {
                withCredentials: true
            },
            dataType: "json",
            success: function(data) {
                if(data.code==0||data.code=='0'){
                    $("#private-textarea").val("");
                    pageToastSuccess("发送私信成功!");
                    closeSendMessage();
                }else{
                    pageToastFail(data.msg);
                }
            }
        })

    }

    //取消关注
    function removeFocus(obj){
        if(isLogin=='false'){
            openLoginWindow();
            return;
        }
        var focus_user_id=$(obj).data("userid");
        $.ajax({
            type: "post",
            url: ctx+"forumQuestion/removeFocus/"+focus_user_id,
            data: null,
            xhrFields: {
                withCredentials: true
            },
            dataType: "json",
            success: function(data) {
                if(data.code==0||data.code=='0'){
                    Fast.msg_success("取消关注成功!");
                    $("#focusBtn").text("关注");
                    $("#focusBtn").removeAttr("onclick").attr("onclick","addFocus(this)");
                }else{
                    Fast.msg_error(data.msg)
                }
            }
        })
    }
    $(function () {
        if(userFocusFlag=='true'){
            $("#focusBtn").text("取消关注").removeAttr("onclick").attr("onclick","removeFocus(this)");
        }else{
            $("#focusBtn").text("关 注").removeAttr("onclick").attr("onclick","addFocus(this)");
        }
        initCity('home');//故乡

        initCity('now');//现居地

        initVisitUserList();
    })
    function city3Change(type){
        var countryId=$("#"+type+"City3").val();
        $("#"+type+"DistrictValue").val(countryId);
    }
    function initCity3(type){
        var cityId=$("#"+type+"City2").val();
        $("#"+type+"CityValue").val(cityId);
        var selectedCountry=$("#"+type+"DistrictValue").val();
        if($.common.isEmpty(cityId)){
            $("#"+type+"City3Div").hide();
            return;
        }
        $.ajax({
            type: "post",
            url: ctx+"plugs/getPositionCountryByCityId?cityId="+cityId+"&selectedCountry="+selectedCountry,
            data: null,
            xhrFields: {
                withCredentials: true
            },
            dataType: "json",
            success: function(data) {
                $("#"+type+"City3Div").show();
                $("#"+type+"City3").easyDropDown("destroy"); // 必不可少,因为前端样式已经变成ul和li了，所以必须先销毁一遍.
                data=data.PositionList;
                $("#"+type+"City3").empty();
                var html="<option value=''>--请选择--</option>";
                $.each(data,function(i,v){
                    if(v.selected=="selected"){
                        html+="<option value='"+v.id+"' selected='selected' data-id='"+v.id+"' >"+v.name+"</option>";
                    }else{
                        html+="<option value='"+v.id+"' data-id='"+v.id+"' >"+v.name+"</option>";
                    }
                });
                $("#"+type+"City3").append(html);
                $("#"+type+"City3").easyDropDown({  wrapperClass: 'flat'});
            }
        })
    }

    function initCity2(type){

        var provinceId=$("#"+type+"City").val();
        $("#"+type+"ProvinceValue").val(provinceId);
        var selectedCity=$("#"+type+"CityValue").val();
        if($.common.isEmpty(provinceId)){
            $("#"+type+"City2Div").hide();
            $("#"+type+"City3Div").hide();
            return;
        }
        $.ajax({
            type: "post",
            url: ctx+"plugs/getPositionCityByProvinceId?provinceId="+provinceId+"&selectedCity="+selectedCity,
            data: null,
            xhrFields: {
                withCredentials: true
            },
            dataType: "json",
            success: function(data) {
                $("#"+type+"City3Div").hide();
                $("#"+type+"City2Div").show();
                $("#"+type+"City2").easyDropDown("destroy"); // 必不可少,因为前端样式已经变成ul和li了，所以必须先销毁一遍.
                data=data.CityList;
                $("#"+type+"City2").empty();
                var html="<option value=''>--请选择--</option>";
                $.each(data,function(i,v){
                    if(v.selected=="selected"){
                        html+="<option value='"+v.id+"' selected='selected' data-id='"+v.id+"' >"+v.name+"</option>";
                    }else{
                        html+="<option value='"+v.id+"' data-id='"+v.id+"' >"+v.name+"</option>";
                    }
                });
                $("#"+type+"City2").append(html);
                $("#"+type+"City2").easyDropDown({  wrapperClass: 'flat'});
                if($.common.isNotEmpty(selectedCity)){
                    initCity3(type);
                }
            }
        })
    }
    function initCity(type){

        var selectedProvince=$("#"+type+"ProvinceValue").val();
        $.ajax({
            type: "post",
            url: ctx+"plugs/getPositionProvinceList?selectedProvince="+selectedProvince,
            data: null,
            xhrFields: {
                withCredentials: true
            },
            dataType: "json",
            success: function(data) {
                $("#"+type+"City").easyDropDown("destroy"); // 必不可少,因为前端样式已经变成ul和li了，所以必须先销毁一遍.
                   data=data.ProvinceList;
                   var html="";
                   $.each(data,function(i,v){
                       if(v.selected=="selected"){
                           html+="<option value='"+v.id+"' selected='selected' data-id='"+v.id+"' >"+v.name+"</option>";
                       }else{
                          html+="<option value='"+v.id+"' data-id='"+v.id+"' >"+v.name+"</option>";
                       }
                   });
                $("#"+type+"City").append(html);
                $("#"+type+"City").easyDropDown({  wrapperClass: 'flat'});
                if($.common.isNotEmpty(selectedProvince)){
                    initCity2(type);
                }
            }
        })
    }
</script>
<script>

    $(".tab-menu ul li").click(function(){

        $(this).addClass("current").siblings().removeClass("current");
        var n=$(this).index();
        if(n==0){
            $("#detail").hide();
            $("#contact").hide();
            $("#essentialinformation").show();
        }
        if(n==1){
            $("#essentialinformation").hide();
            $("#contact").hide();
            $("#detail").show();
        }
        if(n==2){
            $("#essentialinformation").hide();
            $("#detail").hide();
            $("#contact").show();
        }
    });
</script>
</body>
</html>
